<template>
  <el-dialog
    title="信息审核"
    :visible.sync="$store.state.examine.show"
    class="examine-dia"
  >
    <div>
      <el-radio v-model="$store.state.examine.info.sta" label="1">通过</el-radio>
      <el-radio v-model="$store.state.examine.info.sta" label="0">不通过</el-radio>
    </div>
    <div class="textarea-box">
      <el-input
        type="textarea"
        :rows="4"
        placeholder="请输入内容"
        v-model="content">
      </el-input>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="$store.state.examine.show = false">取 消</el-button>
      <el-button type="primary" @click="confirm">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  components: {},
  name: "",
  data() {
    return {
      content:"",
      testArray:[
        "/academicpaper",
        "/teachmaterial",
        "/scientificawards",
        "/softwork",
        "/joinactivity",
        "/runmeeting",
        "/competition",
        "/guidance",
        "/otherteaching",
        "/famoust",
        "/classChange",
        "/researchs",
        "/teachingpaper",
        "/textbooks",
        "/honorary",
        "/professional",
        "/teaching/results",

        "/teaching/project",
        "/teaching/appraise",
        "/teaching/reform",
        "/teaching/course"
      ]
    };
  },
  methods: {
    confirm(){
      if(this.$store.state.examine.info.sta==null){
        _g.toastMsg("warning","状态没有选中")
        return
      }
      var params={
        id : this.$store.state.examine.info.id,
        sta: this.$store.state.examine.info.sta,
        content:this.content
      }
      
      var path=_g.getRouterPath(this)
      var url="teacher/checkall"
      switch(path){
        case "/teacherManage/info":url="teacherinfo/check";break;
        case "/teacherManage/paper":url="teacher/academiccheck";break;
        case "/teacherManage/scientific":url="teacher/workscheck";break;
        case "/teacherManage/meetings":url="teacher/activityscheck";break;
        case "/teacherManage/communicate":url="teacher/meetingcheck";break;

        // case "/academicpaper":url="teacher/checkall";params.tablename="outcomes_academic";break;
        // case "/teachmaterial":url="teacher/checkall";params.tablename="outcomes_monograph";break;
        // case "/scientificawards":url="teacher/checkall";params.tablename="outcomes_scientific";break;
        // case "/softwork":url="teacher/checkall";params.tablename="outcomes_patent";break;
        // case "/joinactivity":url="teacher/checkall";params.tablename="academic_activity";break;
        // case "/runmeeting":url="teacher/checkall";params.tablename="academic_meeting";break;
        // case "/competition":url="teacher/checkall";params.tablename="graduate_award";break;
      }

      if(this.testArray.includes(path)){
        url="teacher/checkall"
        this.$store.state.commonMenu.forEach(ele => {
          if(ele.children){
            params.tablename=ele.children.find(val=>val.url==path)?ele.children.find(val=>val.url==path).tablename:(params.tablename||"")
          }else if(ele.url===path){
            params.tablename=ele.tablename
          }
        });
        // params.tablename=this.$store.state.commonMenu.find(val=>val.url==path).tablename
      }

      // console.log(url,params)
      // return

      _g.apiPost(url,params).then(res=>{
        _g.toastMsg(res.code==0?"success":"error",res.msg)
        if(res.code==0){
          bus.$emit("import_flash")
          bus.$emit("flash","flash")
          this.$store.state.examine.show = false
        }
      })
    }
  },
  created() {}
};
</script>
<style scoped>
.textarea-box{
  margin-top: 10px;
}
</style>